package cn.felord.flyway.controller;

import cn.felord.flyway.entity.Rest;
import cn.felord.flyway.entity.RestBody;
import cn.felord.flyway.entity.SysUser;
import cn.felord.flyway.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * UserController
 *
 * @author Felordcn
 * @since 15:36 2019/10/29
 **/
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private SysUserService sysUserService;


    @GetMapping("/{username}")
    public Rest getUser(@PathVariable String username) {
        SysUser user = sysUserService.queryByUsername(username);
        return RestBody.okData(user);
    }

}
